<template>
	<view class="luckDraw">
		<view class="title">
			<text class="name">源聚变</text>
			<view class="search">
				<input class="search-input" placeholder-style="color:#fff" type="text" value="" placeholder="百事可乐" />
				<image class="search-img" src="../../static/index/search.png" mode=""></image>
			</view>
		</view>
		<view class="content" style="background-image: url('../../static/luckDraw/luckDrawBg.png')">
			<image class="turntable" src="../../static/luckDraw/turntable.png" mode=""></image>
			<view class="lucky-gift">
				<image class="anniu-img" src="../../static/luckDraw/luckly.png" mode=""></image>
				<view class="luckly-box" @click="clickBtn" style="background-image:url('../../static/luckDraw/anniu.png') ;">
					首次免费抽奖
				</view>
				<view class="badge">
					<!-- <view class="badge-box">
						<image class="badge-img" src="../../static/luckDraw/badge.png" mode=""></image>
					</view> -->
					<!-- <text>最高可领汽车</text> -->
				</view>
				<!-- 卡片式轮播 -->
				<view class="u-demo-block">
					<ls-swiper :list="base_lsit" imgKey="imgUrl" :crown="true" :autoplay='true' :loop="true" :shadow='true' height='110'
					 previousMargin="200" nextMargin='200' imgRadius="5" imgWidth="100%" />
				</view>
			</view>
			<!-- 20-100积分 -->
			<view class="samll-box">
				<view class="samll-box-top">
					<text class="samll-box-title">200积分专区</text>
					<view class="middle">
						<!-- <view class="badge-box">
							<image class="badge-img" src="../../static/luckDraw/badge.png" mode=""></image>
						</view> -->
						<!-- <text>最高可领华为电动牙刷</text> -->
					</view>
					<view class="drawnow">
						立即抽奖
					</view>
				</view>
				<ls-swiper :list="base_lsit" imgKey="imgUrl" :crown="true" :autoplay='true' :loop="true" :shadow='true' height='110'
				 previousMargin="200" nextMargin='200' imgRadius="5" imgWidth="100%" dots='true' bottom='-10' />
			</view>
			<view class="samll-box" style="background: linear-gradient(-41deg, #65F1C9 1%, #3CCEC1 100%);">
				<view class="samll-box-top">
					<text class="samll-box-title">1000积分专区</text>
					<view class="middle">
						<!-- <view class="badge-box">
							<image class="badge-img" src="../../static/luckDraw/badge.png" mode=""></image>
						</view> -->
						<!-- <text>最高可领华为电动牙刷</text> -->
					</view>
					<view class="drawnow">
						立即抽奖
					</view>
				</view>
				<ls-swiper :list="base_lsit" imgKey="imgUrl" :crown="true" :autoplay='true' :loop="true" :shadow='true' height='110'
				 previousMargin="200" nextMargin='200' imgRadius="5" imgWidth="100%" dots='true' bottom='-10' />
			</view>
			<view class="samll-box" style="background: linear-gradient(-41deg, #FFAF6F 1%, #F9D674 100%);">
				<view class="samll-box-top">
					<text class="samll-box-title">5000积分专区</text>
					<view class="middle">
						<!-- <view class="badge-box">
							<image class="badge-img" src="../../static/luckDraw/badge.png" mode=""></image>
						</view> -->
						<!-- <text>最高可领华为电动牙刷</text> -->
					</view>
					<view class="drawnow">
						立即抽奖
					</view>
				</view>
				<ls-swiper :list="base_lsit" imgKey="imgUrl" :crown="true" :autoplay='true' :loop="true" :shadow='true' height='110'
				 previousMargin="200" nextMargin='200' imgRadius="5" imgWidth="100%" dots='true' bottom='-10' />
			</view>
			<view class="samll-box" style="background: linear-gradient(-42deg, #FCA398 0%, #FFBDE6 100%);">
				<view class="samll-box-top">
					<text class="samll-box-title">12000积分专区</text>
					<view class="middle">
						<!-- <view class="badge-box">
							<image class="badge-img" src="../../static/luckDraw/badge.png" mode=""></image>
						</view> -->
						<!-- <text>最高可领华为电动牙刷</text> -->
					</view>
					<view class="drawnow">
						立即抽奖
					</view>
				</view>
				<ls-swiper :list="base_lsit" imgKey="imgUrl" :crown="true" :autoplay='true' :loop="true" :shadow='true' height='110'
				 previousMargin="200" nextMargin='200' imgRadius="5" imgWidth="100%" dots='true' bottom='-10' />
			</view>
			<view class="notice" style="background-image: url('../../static/luckDraw/kuang.png');">
				<view class="notice-box" style="background-image: url('../../static/luckDraw/yuan.png');">
					中奖大公告
				</view>
				<image class="laba-img" src="../../static/luckDraw/laba.png" mode=""></image>
				<view class="notice-information">
					<view class="home">
						<view class="list uni-flex uni-column">
							<view class="wrap-item">
								<view class="lis uni-flex uni-column" :animation="animationData">
									<view class="uni-flex uni-column" v-for="(item, index) in list" :key="index">
										<view class="swiper-item item_title uni-flex list_item">
											<!-- <view class="userlistmsg" :class="index%2?'cor':'non'"> -->
											<view class="userlistmsg">
												<image class="userlistmsg-img" :src="item.url" mode=""></image>
												<view>{{ item.text }}</view>
												<!-- <view>{{ item.phone }}</view>
														<view>{{ item.prize }}</view> -->
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<tabbar></tabbar>
	</view>
</template>

<script>
	import {
		tabbar
	} from "../../components/tabbar/tabbar.vue"
	import LsSwiper from '../../components/ls-swiper/index.vue'
	export default {
		components: {
			tabbar,
			LsSwiper
		},
		data() {
			return {
				list: [{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},
					{
						url: '../../static/luckDraw/header.png',
						text: '恭喜用户***抽中一等奖小汽车一辆'
					},

				],
				scrollHeight: 0, //向上滚动距离
				height: 0, //.lis高度（滚动框高度）
				animationData: {}, //动画对像
				base_lsit: [{
					imgUrl: '../../static/luckDraw/one.png',
					name: '1'
				}, {
					imgUrl: '../../static/luckDraw/two.png',
					name: '2'
				}, {
					imgUrl: '../../static/luckDraw/three.png',
					name: '3'
				}, ]
			}
		},
		mounted() {
			// console.log("11")
			this.prizeScroll();
		},
		methods: {
			clickBtn(){
				uni.navigateTo({
					url:'./luckDrawdetails/luckDrawdetails'
				})
			},
			getHeight(Class) {
				let query = uni.createSelectorQuery().in(this);
				query
					.selectAll(Class)
					.boundingClientRect(data => {
						this.height = data[0].height;
					})
					.exec();
			},
			prizeScroll() {
				let speed = 50;
				let animation = uni.createAnimation({
					duration: this.getHeight('.lis') / speed,
					timingFunction: 'linear',
					delay: 0
				});
				this.animation = animation;
				setInterval(() => {
					if (this.scrollHeight >= this.height) {
						animation.translateY(0).step();
						this.scrollHeight = 0;
						this.animationData = animation.export();
					} else {
						this.scrollHeight = this.scrollHeight + 1;
						animation.translateY(-this.scrollHeight).step();
						this.animationData = animation.export();
					}
				}, speed);
			}

		}
	}
</script>

<style scoped lang="less">
	.home,
	.list {
		width: 100%;
		padding-top: 30upx;
		height: 100%;
		overflow: hidden;
	}

	.userlistmsg {
		width: 100%;
		display: flex;
		justify-content: space-around;
		color: #FFFFFF;
		padding: 10rpx 0;
		font-size: 26rpx;

		.userlistmsg-img {
			width: 47rpx;
			height: 47rpx;
			border-radius: 50%;
		}
	}

	// .cor{
	// 	background: #FFF5F3 ;
	// }
	.notice {
		height: 590rpx;
		width: 90%;
		margin: 0 40rpx 5% 5%;
		background-repeat: no-repeat;
		background-size: 100% 100%;
		position: relative;
		display: flex;

		.laba-img {
			width: 37rpx;
			height: 37rpx;
			margin: 90rpx 0 0 50rpx;

		}

		.notice-information {
			flex: 1;
			height: 80%;
			margin-top: 66rpx;
			margin-right: 20px;
		}

		.notice-box {
			width: 209rpx;
			height: 89rpx;
			background-repeat: no-repeat;
			background-size: 100% 100%;
			font-size: 30rpx;
			line-height: 89rpx;
			text-align: center;
			font-family: Source Han Sans CN;
			font-weight: bold;
			color: #FFFFFF;
			position: absolute;
			top: -14px;
			left: 0;
			right: 0;
			margin: 0 auto;
		}
	}

	.badge-box {
		margin-right: 8rpx;
		width: 26rpx;
		height: 26rpx;
		background: #FFA100;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;

		.badge-img {
			width: 16rpx;
			height: 16rpx;
		}
	}

	.samll-box /deep/.wrap {
		margin-top: 20rpx;
		padding: 0;
	}

	.samll-box {
		margin: 67rpx 5%;
		margin-top: 0;
		width: 90%;
		height: 344rpx;
		background: linear-gradient(115deg, #00B0EA 0%, #00CBD8 100%);
		border-radius: 20rpx;
		padding: 0 30rpx;

		.samll-box-top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 28rpx;

			.samll-box-title {
				font-size: 32rpx;
				font-family: Source Han Sans CN;
				font-weight: 500;
				color: #FFFFFF;
			}

			.middle {
				display: flex;
				align-items: center;

				text {
					font-size: 22rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #FF7000;
				}
			}

			.drawnow {
				font-size: 22rpx;
				width: 109rpx;
				height: 33rpx;
				line-height: 33rpx;
				background-color: red;
				text-align: center;
				border-radius: 30rpx;
				color: #FFFFFF;
			}
		}
	}

	/deep/.wrap {
		margin-top: 70rpx;
	}

	.content {
		width: 100%;
		height: auto;
		background-repeat: no-repeat;
		background-size: 100% 100%;
		display: flex;
		flex-direction: column;

		.turntable {
			width: 100%;
			height: 540rpx;
		}

		.badge {
			position: absolute;
			top: 22rpx;
			right: 55rpx;
			width: 160rpx;
			height: 30rpx;
			display: flex;
			align-items: center;

			text {
				font-size: 20rpx;
				font-family: Source Han Sans CN;
				font-weight: 500;
				color: #FF7000;
			}
		}

		.lucky-gift {
			margin: 67rpx 5% 130rpx;
			width: 90%;
			height: 343rpx;
			background: linear-gradient(135deg, #C181EA 0%, rgba(89, 160, 249, 0.5) 100%);
			border-radius: 20rpx;
			position: relative;

			.anniu-img {
				width: 236rpx;
				height: 72rpx;
				position: absolute;
				top: -18px;
				left: 40rpx;
			}

			.luckly-box {
				width: 357rpx;
				height: 114rpx;
				background-size: 100% 100%;
				background-repeat: no-repeat;
				text-align: center;
				line-height: 98rpx;
				color: #FFFFFF;
				font-size: 34rpx;
				position: absolute;
				bottom: -42px;
				left: 0;
				right: 0;
				margin: 0 auto;
			}
		}
	}

	.title {
		display: flex;
		align-items: center;
		width: 100%;
		height: 176rpx;
		background: linear-gradient(153deg, #DD85FC 0%, #2172EB 100%);

		.name {
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #FFFFFF;
			padding: 0 40rpx;
			margin-top: -2%;
		}

		.search {
			position: relative;
			margin-top: -2%;

			.search-input {
				background-color: rgba(225, 225, 225, 0.22);
				border-radius: 30rpx;
				padding-left: 60rpx;
				width: 302rpx;
				height: 64rpx;
				z-index: 99;
			}

			.search-img {
				width: 32rpx;
				height: 32rpx;
				position: absolute;
				top: 16rpx;
				left: 18rpx;
			}
		}
	}
</style>
